# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
  
  def navigation_link_to(name, options = {}, html_options = {}) 
    if current_page?(options)
      content_tag("span", name)
    else
      link_to name, options, html_options
    end
  end

  def navigation_list_link_to(name, options = {}, html_options = {})      
    content_tag("li", navigation_link_to(name, options, html_options))
  end  
  
  def list_link_to(name, options = {}, html_options = {})
    content_tag("li", link_to(name, options, html_options))
  end

  def user_menu
    if logged_in?
      content_tag("p", ("You are logged in as " + 
        link_to(current_user.username, user_path(current_user.username)) + 
        ". " +
        link_to("logout", logout_path)
      ), {:class => "user_info"})
    else
      content_tag("p", link_to("login", login_path) + " or " + link_to("register", register_path), {:class => "user_info"})
    end
  end


end
